package com.davy.tx;

import android.content.Intent;
import android.os.Bundle;


import com.davy.tx.utils.SPUtils;

import java.util.Timer;
import java.util.TimerTask;

public class StartActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setBackgroundDrawableResource(android.R.color.white);
        setContentView(R.layout.activity_start);
    }

    @Override
    protected void onResume() {
        super.onResume();
        TimerTask task = new TimerTask() {
            @Override
            public void run() {
                boolean userType = (Boolean) SPUtils.get(mContext, "userType", false);
                if (userType) {
                    startActivity(new Intent(mContext, MainActivity.class));
                } else {
                    startActivity(new Intent(mContext, LoginActivity.class));
                }
            }
        };
        Timer timer = new Timer();
        timer.schedule(task, 2000);
    }
}
